package com.hxzy.module.admin.mapstruct;

import com.hxzy.module.admin.api.role.req.AdminRoleAddReq;
import com.hxzy.module.admin.api.role.req.AdminRoleEditReq;
import com.hxzy.module.admin.api.role.resp.AdminRoleResp;
import com.hxzy.module.admin.entity.AdminRole;
import org.mapstruct.MapMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @Author wy
 * @Description TODO
 * @Date 2024/1/31 14:56
 * @Version 1.0
 */
@Mapper
public interface AdminMapStruct {

    AdminMapStruct INSTANCE= Mappers.getMapper(AdminMapStruct.class);

    @Mapping(source = "id", target = "roleId"  )
    AdminRoleResp convert(AdminRole entity);

    AdminRole  convert(AdminRoleAddReq req);

    @Mapping(source = "roleId", target = "id"  )
    AdminRole  convert(AdminRoleEditReq req);
}
